<!--回弹业务数据字典---回弹仪器设备管理---查看-->
<template>
  <div class="department" id="department">
    <!-- 右侧 -->
    <div class="department_right">
      <!-- 顶部导航栏 -->
      <div class="mechanism_nav">
        <!-- 左侧 -->
        <div class="mechanism_nav_left">
          <el-radio-group
            v-model="radio"
            size="small"
            @change="modelType($event)"
          >
            <el-radio-button label="待办"></el-radio-button>
            <el-radio-button label="已办"></el-radio-button>
            <!-- #2b5a9d -->
          </el-radio-group>
        </div>
        <!-- 顶部按钮 -->
        <div class="print">
          <div class="printTable">
            <el-button
              type="primary"
              icon="el-icon-refresh"
              size="small"
              @click="yj_searchForm(getList)"
            ></el-button>

            <!-- <el-button
              type="primary"
              icon="el-icon-search"
              size="small"
              v-if="yj_view"
              @click="editText(fId)"
              >查看
            </el-button> -->

            <el-button
              type="primary"
              icon="el-icon-edit"
              size="small"
              v-if="getList.modelType == '0' && yj_edit == true"
              @click="edit()"
            >
              编辑
            </el-button>
            <!-- <el-button
              type="primary"
              icon="el-icon-circle-check"
              size="small"
              v-if="getList.modelType == '0' && yj_submit == true"
              @click="SubmitText(fId)"
            >
              提交
            </el-button> -->
           
          </div>
        </div>
      </div>

      <!-- 表格 -->
      <div class="text_table">
        <tableData
          :height="navigatepageNums > 1 ? 'calc(100% - 50px)' : '100%'"
          :config="table_config"
          :dataList="tableData"
          :loading="loading"
          @selection-change="selectionChange"
          @sort-change="sortChange"
          @click-change="rowChange"
          @ClickOnLine="yj_viewForm"
          :page="getList.page"
          :pageSize="getList.pageSize"
        />
        <pagination
          v-if="navigatepageNums > 1"
          :info="queryCriteriaData"
          :treelength="treelength"
          :total="queryCriteriaData.total"
          :pageNum.sync="getList.page"
          :limit.sync="getList.pageSize"
          @pagination="yj_searchForm(getList)"
        />
      </div>
      <!--配合比通知单编号弹框 查看 -->
      <div class="Control-1 mechanism_dialogS closure">
        <el-dialog
          :title="dialogTitle"
          :modal-append-to-body="false"
          v-dialogDrag
          :visible.sync="dialogEditVisible"
          v-loading="loadingEditDialog"
          element-loading-text="拼命加载中"
          element-loading-spinner="el-icon-loading"
          element-loading-background="rgba(0, 0, 0, 0.2)"
        >
          <div
            class="dialogBody common"
            :style="{ height: '650px' }"
            style="overflow: hidden"
          >
            <div style="overflow-y: auto; margin-bottom: 20px">
              <div class="baseTitle">生产配合比信息</div>
              <div class="publicForm" style="height: 230px">
                <publicForm
                  ref="publicForm"
                  lableWidth="125px"
                  :formObj="formObjText"
                  :formData="formData"
                   fileType="0"
                >
                </publicForm>
              </div>
              <div class="mixProportion">
                <div class="titleBig">
                  <div class="title" style="width: 20%; border-left: none">
                    项目
                  </div>
                  <div class="title">水泥</div>
                  <div class="title">砂</div>
                  <div class="title title1" style="width: 24%">
                    <div class="title1_1">碎石</div>
                    <div class="title1_2">
                      <div class="title1_2_1" style="border-left: none">1</div>
                      <div class="title1_2_1">2</div>
                      <div class="title1_2_1">3</div>
                    </div>
                  </div>
                  <div class="title">水</div>
                  <div class="title">减水剂</div>
                  <div class="title title1" style="width: 16%">
                    <div class="title1_1">外渗料</div>
                    <div class="title1_2">
                      <div class="title1_2_2" style="border-left: none">
                        粉煤灰
                      </div>
                      <div class="title1_2_2">矿渣粉</div>
                    </div>
                  </div>
                  <div class="title">防水添加剂</div>
                </div>
                <div
                  class="titleSmall"
                  v-for="(v, i) in formData.materialList"
                  :key="i"
                >
                  <div
                    class="title2"
                    style="width: 20%; border-left: none"
                    v-text="v[0]"
                  ></div>
                  <div class="title2">
                    <el-input
                      v-model="v[1]"
                      placeholder="/"
                      :disabled="disabled"
                    ></el-input>
                  </div>
                  <div class="title2">
                    <el-input
                      v-model="v[2]"
                      placeholder="/"
                      :disabled="disabled"
                    ></el-input>
                  </div>
                  <div class="title2">
                    <el-input
                      v-model="v[3]"
                      placeholder="/"
                      :disabled="disabled"
                    ></el-input>
                  </div>
                  <div class="title2">
                    <el-input
                      v-model="v[4]"
                      placeholder="/"
                      :disabled="disabled"
                    ></el-input>
                  </div>
                  <div class="title2">
                    <el-input
                      v-model="v[5]"
                      placeholder="/"
                      :disabled="disabled"
                    ></el-input>
                  </div>
                  <div class="title2">
                    <el-input
                      v-model="v[6]"
                      placeholder="/"
                      :disabled="disabled"
                    ></el-input>
                  </div>
                  <div class="title2">
                    <el-input
                      v-model="v[7]"
                      placeholder="/"
                      :disabled="disabled"
                    ></el-input>
                  </div>
                  <div class="title2">
                    <el-input
                      v-model="v[8]"
                      placeholder="/"
                      :disabled="disabled"
                    ></el-input>
                  </div>
                  <div class="title2">
                    <el-input
                      v-model="v[9]"
                      placeholder="/"
                      :disabled="disabled"
                    ></el-input>
                  </div>
                  <div class="title2">
                    <el-input
                      v-model="v[10]"
                      placeholder="/"
                      :disabled="disabled"
                    ></el-input>
                  </div>
                </div>
              </div>
              <div class="publicForm" style="height: 80px">
                <publicForm
                  ref="publicForm0"
                  lableWidth="125px"
                  :formObj="formObjText1"
                  :formData="formData"
                  :timestamp="formData.fFillingfile"
                  :fileList="fSourcefileList"
                   fileType="0"
                >
                </publicForm>
              </div>
              <div class="baseTitle" style="margin-top: 8px">测量情况</div>
              <el-collapse v-model="activeNames" @change="changeCollapse">
                <el-collapse-item name="0">
                  <template slot="title">
                    <div>
                      <img
                        style="vertical-align: middle"
                        src="@/assets/img/Supervision/com_flg.png"
                        alt=""
                      />
                      <span style="margin-left: 8px">场站坍落度实测</span>
                    </div>
                  </template>
                  <div
                    class="publicForm"
                    :style="{
                      height:
                        formData.fIsabandon == '否' ||
                        formData.fIsabandon == null
                          ? '140px'
                          : '65px',
                    }"
                    style="margin-top: 3px"
                  >
                    <publicForm
                      ref="publicForm1"
                      lableWidth="125px"
                      :formObj="handleObjText"
                      :formData="formData"
                      :timestamp="formData.fStationfile"
                      :fileList="stationfileList"
                       fileType="0"
                    >
                    </publicForm>
                  </div>
                </el-collapse-item>

                <el-collapse-item name="1">
                  <template slot="title">
                    <div>
                      <img
                        style="vertical-align: middle"
                        src="@/assets/img/Supervision/com_flg.png"
                        alt=""
                      />
                      <span style="margin-left: 8px">现场坍落度检测</span>
                    </div>
                  </template>
                  <div class="publicForm" style="height: 70px; margin-top: 3px">
                    <publicForm
                      ref="publicForm2"
                      lableWidth="125px"
                      :formObj="processObjText"
                      :formData="formData"
                       fileType="0"
                    >
                    </publicForm>
                  </div>
                </el-collapse-item>
              </el-collapse>
              <div style="height: 50px"></div>
            </div>
          </div>
          <div class="newlyAdded_btn" v-if="btnShow">
            <el-button type="primary" @click="yj_saveForm('formData')"
              >保存</el-button
            >
            <el-button type="warning" @click="dialogEditVisible = false"
              >关闭</el-button
            >
          </div>
        </el-dialog>
      </div>

      <!--生产任务单编号弹框 查看 -->
      <div class="Control-1 mechanism_dialogS">
        <el-dialog
          title="查看生产任务单编号详情"
          :modal-append-to-body="false"
          v-dialogDrag
          :visible.sync="dialogEditVisibleSC"
          v-loading="loadingEditDialogSC"
          element-loading-text="拼命加载中"
          element-loading-spinner="el-icon-loading"
          element-loading-background="rgba(0, 0, 0, 0.2)"
        >
          <div class="dialogBody common" :style="{ height: '550px' }">
            <div class="baseTitle">基本信息</div>
            <div style="height: 110px">
              <publicForm
                ref="publicForm"
                lableWidth="95px"
                :formObj="formObjSC"
                :formData="baseData"
              >
              </publicForm>
            </div>
            <div class="baseTitle">材料用量</div>
            <div
              style="height: 350px; margin-top: 8px"
              id="materialPage"
              class="levelClass materialClass Multi_level_header"
            >
              <el-table
                v-if="isShow"
                stripe
                width="100%"
                min-height="320"
                height="92%"
                :data="tableData1"
                style="width: 99%"
              >
                <el-table-column
                  type="index"
                  :index="indexMethod"
                  label="序号"
                  width="55"
                  align="center"
                />

                <el-table-column
                  prop="F_DischargeDates"
                  label="出料时间"
                  width="150"
                  align="center"
                >
                </el-table-column>
                <el-table-column
                  label="设计重量值(kg)/实际称量值(kg)/重量偏差(%)"
                  align="center"
                >
                  <el-table-column
                    prop="province"
                    label="水"
                    width="60"
                    align="center"
                  >
                    <template slot-scope="scope">
                      <div class="lineBoxhidden">
                        <div>{{ scope.row.F_WaterDesignValue }}</div>
                        <div>{{ scope.row.F_WaterActualValue }}</div>
                        <div :class="'bgwarn' + scope.row.F_WaterWarningLevel">
                          {{ scope.row.F_WaterDeviateValue }}
                        </div>
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column
                    prop="zip"
                    label="水泥1"
                    width="60"
                    align="center"
                  >
                    <template slot-scope="scope">
                      <div class="lineBoxhidden">
                        <div>{{ scope.row.F_Cement1DesignValue }}</div>
                        <div>{{ scope.row.F_Cement1ActualValue }}</div>
                        <div
                          :class="'bgwarn' + scope.row.F_Cement1WarningLevel"
                        >
                          {{ scope.row.F_Cement1DeviateValue }}
                        </div>
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column
                    prop="city"
                    label="水泥2"
                    width="60"
                    align="center"
                  >
                    <template slot-scope="scope">
                      <div class="lineBoxhidden">
                        <div>{{ scope.row.F_Cement2DesignValue }}</div>
                        <div>{{ scope.row.F_Cement2ActualValue }}</div>
                        <div
                          :class="'bgwarn' + scope.row.F_Cement2WarningLevel"
                        >
                          {{ scope.row.F_Cement2DeviateValue }}
                        </div>
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column
                    prop="zip"
                    :label="aggregateData[0]"
                    width="60"
                    align="center"
                  >
                    <template slot-scope="scope">
                      <div class="lineBoxhidden">
                        <div>{{ scope.row.F_Aggregate1DesignValue }}</div>
                        <div>{{ scope.row.F_Aggregate1ActualValue }}</div>
                        <div
                          :class="'bgwarn' + scope.row.F_Aggregate1WarningLevel"
                        >
                          {{ scope.row.F_Aggregate1DeviateValue }}
                        </div>
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column
                    prop="province"
                    :label="aggregateData[1]"
                    width="60"
                    align="center"
                  >
                    <template slot-scope="scope">
                      <div class="lineBoxhidden">
                        <div>{{ scope.row.F_Aggregate2DesignValue }}</div>
                        <div>{{ scope.row.F_Aggregate2ActualValue }}</div>
                        <div
                          :class="'bgwarn' + scope.row.F_Aggregate2WarningLevel"
                        >
                          {{ scope.row.F_Aggregate2DeviateValue }}
                        </div>
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column
                    prop="zip"
                    :label="aggregateData[2]"
                    width="60"
                    align="center"
                  >
                    <template slot-scope="scope">
                      <div class="lineBoxhidden">
                        <div>{{ scope.row.F_Aggregate3DesignValue }}</div>
                        <div>{{ scope.row.F_Aggregate3ActualValue }}</div>
                        <div
                          :class="'bgwarn' + scope.row.F_Aggregate3WarningLevel"
                        >
                          {{ scope.row.F_Aggregate3DeviateValue }}
                        </div>
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column
                    prop="city"
                    :label="aggregateData[3]"
                    width="60"
                    align="center"
                  >
                    <template slot-scope="scope">
                      <div class="lineBoxhidden">
                        <div>{{ scope.row.F_Aggregate4DesignValue }}</div>
                        <div>{{ scope.row.F_Aggregate4ActualValue }}</div>
                        <div
                          :class="'bgwarn' + scope.row.F_Aggregate4WarningLevel"
                        >
                          {{ scope.row.F_Aggregate4DeviateValue }}
                        </div>
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column
                    prop="zip"
                    :label="aggregateData[4]"
                    width="60"
                    align="center"
                  >
                    <template slot-scope="scope">
                      <div class="lineBoxhidden">
                        <div>{{ scope.row.F_Aggregate5DesignValue }}</div>
                        <div>{{ scope.row.F_Aggregate5ActualValue }}</div>
                        <div
                          :class="'bgwarn' + scope.row.F_Aggregate5WarningLevel"
                        >
                          {{ scope.row.F_Aggregate5DeviateValue }}
                        </div>
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column
                    prop="province"
                    label="矿粉"
                    width="60"
                    align="center"
                  >
                    <template slot-scope="scope">
                      <div class="lineBoxhidden">
                        <div>{{ scope.row.F_OreDesignValue }}</div>
                        <div>{{ scope.row.F_OreActualValue }}</div>
                        <div :class="'bgwarn' + scope.row.F_OreWarningLevel">
                          {{ scope.row.F_OreDeviateValue }}
                        </div>
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column
                    prop="zip"
                    label="粉煤灰"
                    width="65"
                    align="center"
                  >
                    <template slot-scope="scope">
                      <div class="lineBoxhidden">
                        <div>{{ scope.row.F_FlyashDesignValue }}</div>
                        <div>{{ scope.row.F_FlyashActualValue }}</div>
                        <div :class="'bgwarn' + scope.row.F_FlyashWarningLevel">
                          {{ scope.row.F_FlyashDeviateValue }}
                        </div>
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column
                    prop="city"
                    label="外加剂1"
                    width="70"
                    align="center"
                  >
                    <template slot-scope="scope">
                      <div class="lineBoxhidden">
                        <div>{{ scope.row.F_Admixture1DesignValue }}</div>
                        <div>{{ scope.row.F_Admixture1ActualValue }}</div>
                        <div>{{ scope.row.F_Admixture1DeviateValue }}</div>
                      </div>
                    </template>
                  </el-table-column>
                  <el-table-column
                    prop="zip"
                    label="外加剂2"
                    width="70"
                    align="center"
                  >
                    <template slot-scope="scope">
                      <div class="lineBoxhidden">
                        <div>{{ scope.row.F_Admixture2DesignValue }}</div>
                        <div>{{ scope.row.F_Admixture2ActualValue }}</div>
                        <div>{{ scope.row.F_Admixture2DeviateValue }}</div>
                      </div>
                    </template>
                  </el-table-column>
                </el-table-column>
                <el-table-column
                  prop="F_ActualCalculation"
                  label="实际方量"
                  width="70"
                  align="center"
                >
                </el-table-column>
              </el-table>

              <div
                class="pagination"
                style="
                  display: flex;
                  justify-content: space-between;
                  padding-top: 6px;
                "
                v-if="navigatepageNums1 > 1"
              >
                <div class="paginationInfo" style="font-size: 12px">
                  检索到{{ queryCriteriaData1.total }} 条记录 | 显示第
                  <span v-if="tableList.page == 1">{{ tableList.page }}</span
                  ><span v-else>{{ 3 * (tableList.page - 1) + 1 }}</span>
                  <span
                    v-if="
                      queryCriteriaData1.pages == queryCriteriaData1.lastPage
                    "
                  >
                    -{{ queryCriteriaData1.total }}条记录</span
                  >
                  <span v-else>- {{ 3 * tableList.page }} 条记录</span>
                </div>
                <el-pagination
                  background
                  @size-change="handleSizeChange"
                  @current-change="handleCurrentChange"
                  :current-page="tableList.page"
                  :page-size="tableList.pageSize"
                  layout="prev, pager, next, jumper"
                  :total="queryCriteriaData1.total"
                >
                </el-pagination>
              </div>
            </div>
          </div>
        </el-dialog>
      </div>
    </div>
  </div>
</template>

<script>
import {
  getConcreteRecipeByFid, //详情
  saveConcreteRecipeBySite, //保存
  getConcreteRecipeLists, //列表
  // deleteConcreteRecipe, //删除
  commitConcreteRecipe, //提交
  getTotalAmountDetail, //弹框2列表详情接口
  // getStationmachineByfMachineid, //调骨料名接口
} from "@/api/request.js";
import TableData from "@/components/HntManage/el-tables"; //主页面列表
import Pagination from "@/components/public/el-pagination"; //主页面分页
import publicForm from "@/components/public/el-form.vue"; //弹框form
import formJs from "./regexDetail.js"; //新增弹框配置项

export default {
  inject: ["reload"],
  name: "siteCollapseText",
  data() {
    return {
      name: "siteCollapseText",
      // 分页
      navigatepageNums: null, //是否显示分页
      queryCriteriaData: {},
      // 分页
      // yj_view: null,
      yj_edit: null,
      yj_delete: null,
      yj_submit: null,
      radio: "待办",
      // 列表
      getList: {
        fCheckStatus: "3",
        modelType: "", // 0代办 1已办 不传或传空 表示列表页查询
        page: 1, //页码
        pageSize: 20, //每页条数
        projectId: "", // 查询条件项目ID
        companyId: "", // 查询条件标段ID
        stationId: "", // 查询条件拌合站ID
        machineId: "", // 查询条件拌合机ID
        fCompanyid: "", // 左侧选中组织机构id
        userId: "", // 查询待办或已办时传 列表页查询不传
      },
      fId: null, //当前行数据fId
      loading: false, //列表转载
      table_config: formJs.table_configText,
      tableData: [], //表格列表数据列表
      // 列表

      // 弹框
      timeYMD: null, //当前日期
      btnShow: true,
      disabled: false,
      dialogTitle: "",
      loadingEditDialog: false, //弹框loading
      dialogEditVisible: false, //新增弹框是否显示
      formObjText: formJs.formObjs,
      formObjText1: formJs.formObj1s,
      handleObjText: formJs.handleObj,
      processObjText: null,
      processObj: formJs.processObj, //查看
      processObjs: formJs.processObjs, //编辑

      formData: formJs.formData,
      fSourcefileList: [],
      stationfileList: [],
      saveData: formJs.saveData,
      // 弹框

      // 弹框2
      loadingEditDialogSC: false, //弹框loading
      dialogEditVisibleSC: false, //新增弹框是否显示
      formObjSC: formJs.formObjSC, //生产任务单弹框
      baseData: formJs.baseData,
      isShow: false,
      navigatepageNums1: null, //是否显示分页
      queryCriteriaData1: {}, //分页
      aggregateData: ["骨料1", "骨料2", "骨料3", "骨料4", "骨料5"],
      tableData1: [],
      tableList: {
        companyid: "", // 施工标段id
        taskNumber: "",
        page: 1, // 当前页码
        pageSize: 3, // 每页显示条数
      },
      // 弹框2
      activeNames: ["1"],
      userInfo: {}, //登录用户
    };
  },
  components: {
    TableData, //主页面列表
    Pagination, //分页
    publicForm, //表单
  },
  created() {},
  mounted() {
    this.userInfo = JSON.parse(sessionStorage.getItem("userInfo"));
    console.log(this.userInfo);
    this.getList = {
      fCheckStatus: "3",
      modelType: "0", // 0代办 1已办 不传或传空 表示列表页查询
      page: 1, //页码
      pageSize: 20, //每页条数
      projectId: "", // 查询条件项目ID
      companyId: "", // 查询条件标段ID
      stationId: "", // 查询条件拌合站ID
      machineId: "", // 查询条件拌合机ID
      fCompanyid: this.userInfo.companyId, // 左侧选中组织机构id
      userId: this.userInfo.userId, // 查询待办或已办时传 列表页查询不传
    };
    this.getHeight();
    this.getData();
    this.yj_searchForm(this.getList);
    this.btnRole(this.name);

    this.table_config.operation.cols = [
      {
        prop: "fStatus",
        type: "primary",
        handleRow: this.handleRow,
      },
    ];
    this.table_config.operation["specialClass"] = function (rowData) {
      var color = null;
      if (rowData == "未提交") {
        color = "red !important";
      } else if (rowData == "生产中") {
        color = "#409eff !important";
      } else if (rowData == "运输中") {
        color = "#e6a23c  !important";
      } else {
        color = "green !important";
      }
      return color;
    };
  },
  methods: {
    btnRole(name) {
      var btnList = [];
      var ModuleList = JSON.parse(sessionStorage.getItem("ModuleList"));
      if (ModuleList.length > 0) {
        ModuleList.map((item) => {
          if (item.fEncode == name) {
            btnList = item.modulebuttonList;
          }
        });
        var btnStr = [];
        btnList.map((item) => {
          btnStr.push(item.fEncode);
        });
        // this.yj_view = btnStr.includes("yj_view");
        this.yj_edit = btnStr.includes("yj_edit");
        // this.yj_delete = btnStr.includes("yj_delete");
        this.yj_submit = btnStr.includes("yj_submit");
      } else {
        // this.yj_view = true;
        this.yj_edit = true;
        // this.yj_delete = true;
        this.yj_submit = true;
      }
    },

    modelType(e) {
      this.fId = "";
      if (e == "待办") {
        this.getList.modelType = "0";
        this.getList.userId = this.userInfo.userId;
      } else {
        this.getList.modelType = "1";
        this.getList.userId = this.userInfo.userId;
      }
      this.yj_searchForm(this.getList);
    },

    // 获取列表数据
    yj_searchForm(id) {
      this.loading = true;
      getConcreteRecipeLists(id)
        .then((res) => {
          if (res.errcode == 0) {
            var that = this;
            that.loading = false;
            that.tableData = res.data.pageInfo.list;
            that.queryCriteriaData = res.data.pageInfo;
            that.navigatepageNums =
              that.queryCriteriaData.navigatepageNums.length;
          } else {
            this.$message.error("列表", res.msg);
            this.loading = false;
          }
        })
        .catch(() => {
          console.log("列表");
          this.loading = false;
        });
    },

    edit() {
      this.recordfiles = [];
      this.disabled = true;
      this.processObjText = this.processObjs;
      this.dialogTitle = "编辑";
      this.btnShow = true;
      if (this.fId != "" && this.fId != null) {
        this.loadingEditDialog = true; //弹框loading
        this.dialogEditVisible = true;
        this.getConcrete(this.fId);
      } else {
        return this.$message.error("请先选择需要编辑的数据");
      }
    },
    // 获取详情
    getConcrete(id) {
      getConcreteRecipeByFid({ fId: id })
        .then((res) => {
          this.loadingEditDialog = false; //弹框loading
          this.formData = res.data.concreteRecipe;
          this.formData.fSitetestedates = this.timeYMD;
          this.formData.fSitetesterid = this.userInfo.userId; // 现场检测人id
          this.formData.fSitetestername = this.userInfo.realName; // 现场检测人名称
          this.fSourcefileList = res.data.fillingfile;
          this.stationfileList = res.data.stationfile;
          if (res.data.concreteRecipe.fIsabandon == "否") {
            this.handleObjText[1].label = "检测说明";
            this.handleObjText[2].label = "场站实测人";
            this.handleObjText[3].label = "场站检测日期";
          } else if (res.data.concreteRecipe.fIsabandon == "是") {
            this.handleObjText[1].label = "作废原因";
            this.handleObjText[2].label = "作废人";
            this.handleObjText[3].label = "作废时间";
          }
        })
        .catch((err) => {
          console.log(err);
        });
    },
    // 保存
    yj_saveForm() {
      if (this.$refs.publicForm.submitForm()) {
        if (this.$refs.publicForm0.submitForm()) {
          this.saveData = {
            fId: this.formData.fId,
            fSitetestslump: this.formData.fSitetestslump, // 现场实测塌落度
            fSitetestnote: this.formData.fSitetestnote, // 现场检测说明
            fSitetesterid: this.formData.fSitetesterid, // 现场检测人id
            fSitetestername: this.formData.fSitetestername, // 现场检测人名称
            fSitetestedates: this.formData.fSitetestedates, // 现场检测时间
          };
          console.log("保存saveData", this.saveData);
          saveConcreteRecipeBySite(this.saveData)
            .then((res) => {
              if (res.errcode == 0) {
                this.yj_searchForm(this.getList);
                this.dialogEditVisible = false;
                this.$message.success("新增成功");
              } else {
                this.$message.error(res.msg);
                console.log("接口报错");
              }
            })
            .catch((error) => {
              console.log(error);
            });
        } else {
          console.log("error");
        }
      } else {
        console.log("error");
      }
    },

    // 提交
    SubmitText(id) {
      if (id != "" && id != null) {
        this.$confirm("是否继续提交?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        })
          .then(() => {
            this.loading = true;
            commitConcreteRecipe({
              fId: id,
              userId: this.userInfo.userId,
              userName: this.userInfo.realName,
            })
              .then((res) => {
                if (res.errcode == 0) {
                  this.loading = false;
                  this.yj_searchForm(this.getList);
                  this.$message.success("提交成功");
                } else {
                  this.$message.error("提交失败", res.msg);
                  this.loading = false;
                }
              })
              .catch(() => {
                console.log("提交失败");
                this.loading = false;
              });
          })
          .catch(() => {
            this.$message("取消提交");
          });
      } else {
        return this.$message.error("请先选择需要提交的数据");
      }
    },

    // // 删除
    // rowDelete(id) {
    //   if (id != "" && id != null) {
    //     this.$confirm("此操作将永久删除该数据, 是否继续?", "提示", {
    //       confirmButtonText: "确定",
    //       cancelButtonText: "取消",
    //       type: "warning",
    //     })
    //       .then(() => {
    //         this.loading = true;
    //         deleteConcreteRecipe({ fId: id })
    //           .then((res) => {
    //             if (res.errcode == 0) {
    //               this.loading = false;
    //               this.yj_searchForm(this.getList);
    //               this.$message.success("删除成功");
    //             } else {
    //               this.$message.error("删除失败", res.msg);
    //               this.loading = false;
    //             }
    //           })
    //           .catch(() => {
    //             console.log("删除失败");
    //             this.loading = false;
    //           });
    //       })
    //       .catch(() => {
    // this.$message("取消删除");
    //       });
    //   } else {
    //     return this.$message.error("请先选择需要删除的数据");
    //   }
    // },

    // 获取页面容器高度
    getHeight() {
      var h = document.documentElement.clientHeight; //获取页面可见高度
      this.dialogHeight = h * 0.36 + "px";
    },
    // 点击查看
    yj_viewForm(row, label) {
      this.row = row;
      this.fId = row.fId;
      if (label == "配合比通知单编号") {
        this.editText(this.fId);
      } else if (label == "生产任务单编号") {
        this.editText2(row);
      }
    },

    // 查看
    editText(id) {
      this.dialogTitle = "查看";
      this.btnShow = false;
      this.disabled = true;
      this.processObjText = this.processObj;
      if (id != "" && id != null) {
        this.loadingEditDialog = true; //弹框loading
        this.dialogEditVisible = true;
        getConcreteRecipeByFid({ fId: id })
          .then((res) => {
            if (res.errcode == 0) {
              var that = this;
              that.loadingEditDialog = false;
              this.formData = res.data.concreteRecipe;
              this.fSourcefileList = res.data.fillingfile;
              this.stationfileList = res.data.stationfile;
              if (res.data.concreteRecipe.fIsabandon == "否") {
                this.handleObjText[1].label = "检测说明";
                this.handleObjText[2].label = "场站实测人";
                this.handleObjText[3].label = "场站检测日期";
              } else if (res.data.concreteRecipe.fIsabandon == "是") {
                this.handleObjText[1].label = "作废原因";
                this.handleObjText[2].label = "作废人";
                this.handleObjText[3].label = "作废时间";
              }
            } else {
              this.$message.error("查看", res.msg);
              this.loadingEditDialog = false;
            }
          })
          .catch(() => {
            console.log("查看---详情接口报错");
            this.loadingEditDialog = false;
          });
      } else {
        return this.$message.error("请先选择需要查看的数据");
      }
    },
    // 弹框2
    editText2(row) {
      // if (row.fMachineid !== "" && row.fMachineid !== null) {
      this.dialogEditVisibleSC = true;
      this.loadingEditDialogSC = true;
      this.tableList.taskNumber = row.fProducetasknumber;
      this.tableList.companyid = row.fCompanyid;
      this.tableList.page = 1;
      // getStationmachineByfMachineid({ machineId: row.fMachineid })
      //   .then((res1) => {
      //     if (res1.errcode == 0) {
      // console.log(res1);
      // this.aggregateData = [
      //   res1.data.yjQmpMsStationmachine.fParm1,
      //   res1.data.yjQmpMsStationmachine.fParm2,
      //   res1.data.yjQmpMsStationmachine.fParm3,
      //   res1.data.yjQmpMsStationmachine.fParm4,
      //   res1.data.yjQmpMsStationmachine.fParm5,
      // ];
      this.isShow = true;
      getTotalAmountDetail(this.tableList)
        .then((res) => {
          if (res.errcode == 0) {
            console.log("任务单号详情", res);
            var that = this;
            that.dialogEditVisibleSC = true;
            that.loadingEditDialogSC = false;
            that.tableData1 = res.data.pageInfo.list;

            this.baseData = {
              F_ProduceTaskNumber: row.fProducetasknumber, // 生产任务编号
              F_EngineeringName: row.fEnginerringname, // 工程名称
              F_EngineeringPartName: row.fEnginerringpart, // 工程部位
              F_StrengthGrade: row.fStrengthlevel, // 强度等级
              F_DischargeDates: that.tableData1[0].F_DischargeDates, // 出料时间
            };
            that.queryCriteriaData1 = res.data.pageInfo; //分页信息
            that.navigatepageNums1 =
              that.queryCriteriaData1.navigatepageNums.length;
          }
        })
        .catch(() => {
          console.log("任务单详情接口报错");
        });
      //   }
      // })
      // .catch(() => {
      //   console.log("骨料名称接口报错");
      // });
      // } else {
      //   return this.$message.error("本条数据暂时没有生产记录");
      // }
    },

    indexMethod(index) {
      return index + 1 + (this.tableList.page - 1) * 3; // page是当前的页码，size是页码容量
    },
    handleCurrentChange(val) {
      this.tableList.page = val;
      this.tableList.taskNumber = this.row.fProducetasknumber;
      this.tableList.companyid = this.row.fCompanyid;
      getTotalAmountDetail(this.tableList).then((res) => {
        if (res.errcode == 0) {
          console.log(res.data);
          var that = this;
          that.tableData1 = res.data.pageInfo.list;
          this.queryCriteriaData1 = res.data.pageInfo; //分页信息
          this.navigatepageNums1 =
            this.queryCriteriaData1.navigatepageNums.length;
        } else {
          this.$message.error(res.msg);
        }
      });
    },
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
    },
    // 折叠面板
    changeCollapse(e) {
      console.log(this.activeNames, e);
    },
    // 弹框2
    getData() {
      var time = new Date();
      const y = time.getFullYear();
      const m = (time.getMonth() + 1 + "").padStart(2, "0");
      const d = (time.getDate() + "").padStart(2, "0");
      this.timeYMD = `${y}-${m}-${d}`;
    },
    // 点击当前
    rowChange(val) {
      this.row = val;
      this.fId = val.fId;
    },

    // 多选方法
    selectionChange() {},
    // 排序方法
    sortChange() {},
  },
};
</script>

<style scoped>
.printTables {
  background: #fff;
  display: flex;
  justify-content: end;
  padding: 5px;
  margin-top: 10px;
}

.dialogBody {
  padding: 3px 20px;
  height: 80%;
  overflow-y: auto;
}

.baseTitle {
  /* border: 1px solid #0c204d; */
  border-bottom: 1px solid #0c204d;
  height: 30px;
  line-height: 30px;
  position: relative;
  padding-left: 15px;
}

.baseTitle::after {
  display: block;
  content: "";
  height: 30px;
  width: 5px;
  position: absolute;
  left: 0;
  top: 0;
  background: #0c204d;
}
/* 砼配合比表格 */
.mixProportion {
  width: 100%;
  height: 200px;
  margin: 20px 0;
  border-top: 1px solid #ccc;
  border-left: 1px solid #ccc;
  border-right: 1px solid #ccc;
}
.titleBig {
  width: 100%;
  height: 60px;
  border-bottom: 1px solid #ccc;
  display: flex;
  justify-content: space-between;
}
.title {
  height: 100%;
  width: 8%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-left: 1px solid #ccc;
  font-size: 12px;
  font-weight: 700;
}
.title1 {
  display: flex;
  flex-direction: column;
}
.title1_1 {
  width: 100%;
  height: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  border-bottom: 1px solid #ccc;
}
.title1_2 {
  width: 100%;
  height: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
}
.title1_2_1 {
  width: 33%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  border-left: 1px solid #ccc;
}
.title1_2_2 {
  width: 50%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  border-left: 1px solid #ccc;
}
.titleSmall {
  width: 100%;
  height: 30px;
  border-bottom: 1px solid #ccc;
  /* background: #0c204d; */
  display: flex;
}
.title2 {
  width: 8%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  border-left: 1px solid #ccc;
}
.titleSmall /deep/ .el-input__inner {
  height: 27px !important;
  line-height: 26px !important;
  text-align: center;
  border: none;
}
.titleSmall /deep/ .el-input {
  line-height: 28px !important;
}
/* 砼配合比表格 */
/* 任务单弹框 */
.Multi_level_header /deep/.el-table__body-wrapper tr {
  height: 80px !important;
}

.Multi_level_header /deep/.el-table__body-wrapper .lineBoxhidden {
  height: 64px !important;
  line-height: 22px !important;
}

.Multi_level_header /deep/.el-table .el-table__body-wrapper .cell {
  height: 100% !important;
}

.materialClass /deep/.el-table tr:nth-child(4) {
  display: none;
}

#materialPage /deep/ .bgwarn2 {
  background: #e6a23c !important;
  color: #fff !important;
}

#materialPage /deep/ .bgwarn1 {
  background: #409eff !important;
  color: #fff !important;
}

#materialPage /deep/ .bgwarn3 {
  background-color: #f56c6c !important;
  color: #fff !important;
}

#materialPage /deep/ .bgwarn4 {
  background-color: rgb(212, 179, 137) !important;
  color: #fff !important;
}
/* 任务单弹框 */
</style>
